/**
 * 
 */
package com.wubo.sec.service;

import org.springframework.context.ApplicationListener;

import com.wubo.sec.core.UserData;
import com.wubo.sec.core.UserLoginProcessor;
import com.wubo.sec.event.PasswordChangeEvent;
import com.wubo.sec.ex.AbstractUserLoginProcessor;

/**
 * @author WuBo
 * @CreateDate 2010-9-6
 * @version 1.0.01
 */
public class UserLoginProcessorImpl extends AbstractUserLoginProcessor
					implements UserLoginProcessor, ApplicationListener<PasswordChangeEvent> {

	@Override
	protected UserData doLogin(String username) {
		return userService.getByUsername(username, true);
	}

	public void onApplicationEvent(PasswordChangeEvent event) {
		userService.onPasswordChange((UserData)event.getSource(), event.getNewPwd());
	}
}
